Converting Distributions
= Introduction = If a distribution is already installed on your hard disk you can convert it to be runnable by coLinux by following these steps. (If you have not installed coLinux yet, first read GettingStarted . Also check the Back Links button above for other references.) WARNING!!! The following procedure tries to be a non destructive one i.e. you can boot the linux distribution either standalone or from within Windows via coLinux. There will be some complaints about missing modules char-major-N etc but I think this is OK as in coLinux there is not possible to access /dev/hda, /dev/hdb etc. A. Define the partitions in default.colinux.conf (see co Linux F A Q Q3 on how to define disk partitions as block devices) # define one block_device for each one existing partition cobd2="\Device\Harddisk1\Partition2" cobd4="\Device\Harddisk1\Partition4" cobd5="\Device\Harddisk1\Partition5" # define the root partition root=/dev/cobd You may also be interested in defining 'cofs' block devices, for accessing the partitions Windows is already using; see cofs device for details. B. Create /dev/cobdN devices in the linux partition for i in {0..7} do mknod /dev/cobd$i b 117 $i done * PS. I think that currently only 8 cobd devices are supported (at least as of 0.6.0) * PPS. tylernt The limit appears to be 32 on 0.6.2. C. Insert lines for /dev/cobdN devices in /etc/fstab Assuming that you have assigned the same device numbers with the linux partition numbers, then for each one partition (defined in the default.colinux.conf) write in /etc/fstab a line similar to the existing one that corresponds to the linux partition eg Existing linux partitions in /etc/fstab /dev/hdb2 / ext3 defaults,errors=remount-ro 0 1 /dev/hdb4 none swap sw 0 0 /dev/hdb5 /usr ext3 rw 0 1 Defined devices in default.colinuc.conf as described in A. New lines in /etc/fstab /dev/cobd2 / ext3 defaults,errors=remount-ro 0 0< /dev/cobd4 none swap sw 0 0 /dev/cobd5 /usr ext3 rw 0 0 tylernt Note that newer versions of co Linux support aliases, that is, you can tell coLinux to map it's /dev/cobd# devices to more normal /dev/hda#. This should allow easier dual-booting. However, as of 0.6.2, I have been unable to boot from an aliased root partition (I still had to use /dev/cobd0)...As of 0.6.4, booting from the aliased root partition can be confirmed atleast with XP SP2 + Gentoo. Another possibility would be to mount partitions using filesystem labels, e.g. with ext2/ext3 partitions you first assign the label, using the command: e2label /dev/hdb2 rootpart and then use a corresponding fstab entry: LABEL=rootpart / ext3 defaults,errors=remount-ro 0 0 D. Store the needed modules of the running coLinux kernel in /lib/modules of the Linux partition You should have already installed the coLinux binaries (with or without the disk image depending on whether you wanted that option) using the instructions in the "Getting Started" Section If the kernel in the already existing distribution its not the same as the coLinux one I run it at two machines * one with a Debian kernel 2.4.17 and * one with Componetized Linux (Debian clone from progeny) with a 2.6.0 kernel) then you need to * have access to vmlinux-modules.tar.gz ** run standalone in order to have access to C:\coLinux as you don't have the cobd module ** assume C:\ is mounted on /c and coLinux is in C:\coLinux * extract vmlinux-modules.tar.gz cd / tar xzvf /c/coLinux/vmlinux-modules.tar.gz This section, D, is confusing to me; if the below instructions are correct, someone please rewrite. I think we can assume that coLinux's and the distro's kernels are different. # Make a copy of the colinux kernel modules to your new distrobution: (see debianmodules) # Reboot to Windows and in default.colinux.conf point to your existing distro's root partition by using the tag (as shown in Step A, above). # Start colinux with "colinux-daemon.exe @default.colinux.conf" and hopefully these instructions are correct. If this is indeed correct then it should logically be Step A. E. If converting from a QEMU RAW virtual disk image tylernt As of coLinux 0.6.2, a QEMU (and I assume Bochs) RAW virtual disk image can be converted to coLinux if you strip off the first 63 512-byte blocks. The easiest way to do this is using dd. Change to the directory with your virtual disk, and run: dd if=qemuimage of=colinuximage bs=512 skip=63 If you are running Windows as your host OS, you don't have a dd command, but you can download a Windows port of dd from http://unxutils.sourceforge.net/. On Linux, you can verify that the procedure was successful by mounting it in a loopback, like this: mkdir /mnt/tmp mount colinuximage /mnt/tmp -o loop -t ext3 (substitute your filesystem on the end there). If you don't get an error message, you're good to go. umount /mnt/tmp and copy your virtual disk image over to coLinux. F. Changes needed for not running the X server if under coLinux See X with co Linux for more details. NOTE(egravers): It is also possible to avoid X startup on most distributions by changing the runlevel to 3 (multi-user with network). This can be done either by editing /etc/inittab in the runtime fs, or by passing "3" as part of the bootparams element in the .conf file; example: root=/dev/cobd0 3 For not starting kdm I created a small script 'isStandAlone' which tells me if I am running under coLinux or not #cat > /root/isStandAlone <<+EOF : dd if=/dev/hdb2 of=/dev/null bs=1 count=1 > /dev/null 2>&1 exit $? +EOF then at the begining of /etc/init.d/kdm I added set -e + /root/isStandAlone || exit 0 In this way kdm is not started when the system boots in coLinux. Remark: If an alias hdb2 is set, this don't work. Better way is to check the kernelversion. Add at the begining of /etc/init.d/kdm this lines: # do nothing, if coLinux running if uname -r | grep -qe "-co-" then echo "kdm skipped (Colinux)" exit 0 fi Example of using XDMCP with GDM This above script can used in many other places to change the files used, etc. For example we can automate what is describled in X with co Linux section III.A.1 XDMCP with GDM We need two gdm conf files * /etc/X11/gdm/gdm.standAlone * /etc/X11/gdm/gdm.coLinux and /etc/X11/gdm/gdm.conf is a link to one of them At the begining of /etc/init.d/gdm the following lines are added set -e + /bin/rm -f /etc/X11/gdm/gdm.conf.old + /bin/mv /etc/X11/gdm/gdm.conf /etc/X11/gdm/gdm.conf.old + if /root/isStandAlone ; then + ln -s /etc/X11/gdm.standAlone /etc/X11/gdm.conf + else + ln -s /etc/X11/gdm.coLinux /etc/X11/gdm.conf + fi and we are OK. Looking at my Current /proc/version which probably should give the most clean way to detect whether running in colinux or not: Linux version 2.6.33-co-0.8.0 (hn@hn-lt) (gcc version 4.4.1 revision 150839 (SUSE Linux) ) #1 PREEMPT Sun Mar 21 19:46:28 UTC 2010 so searching for '-co-' seems to be most portable for me: if grep -q -- '-co-' /proc/version; then echo "Running Colinux"; else echo "Running native"; fi G. Network stuff For a detail networking HOWTO see coLinuxNetworking My experience is as follows: #I used a bridge connection of Tap-Win32 Network adapter with the existing network adapter as described in the networking HOWTO #I confirmed that I use a different IP for the Linux from the one used by Windows when coLinux is running. #gn# Pay attention to the file /etc/modules.conf. It should not contain any string like alias tap0 ethertap If so, just comment each of these lines (also for tap1, tap2 etc.) I found this necesseray under Suse. H. Distro Specific Some of the below have already been done for you on any of the downloadable images. You can also have a look at a short script that can build a new coLinux Debian image with debootstrap: cobootstrap.sh (A notable exception are the gentoo images, due to them using devfs, which requires that you use a devfs enabled kernel. The kernels supplied with the binary releases for coLinux 0.5.3 and above already support devfs) Mandrake tuxthepeguin I used 9.2 but know it also to be true of 9.0, 9.1, 10.0. * When you edit /etc/fstab colinux 0.6.1 does not support supermount. ** To prevent an automatic e2fsck on boot with colinux you need to edit etc/rc.d/rc.sysinit and comment out (do this with vi (which is really vim in mandrake) and i for insert and add 1. at the beginning of the lines) the Fscck() and the _RUN_QUOTACHECK sections. ** Both of these errors will drop you into error shell when booting. ** Also after booting Mandrake it will read a supermount of your harddrive. * To turn on xdmcp for kdm in Mandrake the file to edit is /usr/share/config/kdm/kdmrc In my case to be able to xdmcp to the Mandrake w/o my dialup on I had to add colinux to etc/hosts and then add the colinux host to etc/X11/xdm/Xaccess. Another solution is to disable supermount by typing (added by Alain): supermount disable Gentoo Expert take from Gentoo forums posting at http://forums.gentoo.org/viewtopic.php?t=163154&start=73 If Gentoo does not boot due to fsck checks you may have to edit you /sbin/rc script and use two seperate fstab files. Thanks Shiznix for your help, read below for his fix: Create two fstab files in /etc, one for Gentoo called fstab.default, the other for coLinux called fstab.colinux. At boot, have /sbin/rc remount '/' (rw), check the running kernel & copy over /etc/fstab with the correct one, remount '/' (ro). Edit /sbin/rc, scroll down to just below Code: echo -e " Copyright 2001-2003 Gentoo Technologies, Inc.; Distributed under the GPL" echo Add in the following lines: Code: echo -e "Detected running kernel version `uname -r`" echo -e "Adjusting /etc/fstab accordingly..." echo mount -o rw,remount / if uname -r | grep -q -- "-co-"; then cp /etc/fstab.colinux /etc/fstab else cp /etc/fstab.default /etc/fstab fi mount -o ro,remount / It should now boot seamlessly whether using coLinux or Gentoo. Android There's now a running "LiveAndroid" i386 distro (German announcement) which should work. However, I am confused as to whether it is amenable to the Slackware HOWTO so I will ask on the developer list for someone to expand this section. NOTE: LiveAndroid never made it to v0.4 pending e.g. WiFi support. Please see http://www.android-x86.org/ which is well-maintained as of late 2013. I also have no idea whether that will work with the Slackware HOWTO linked above or what the video display best practices would be. :Probably you will want VNChttp://code.google.com/p/android-vnc-viewer/ but maybe X will workhttp://imandroid.org/2009/02/25/run-x-windows-within-android-via-x11-hack/. Category:Distributions Category:HOWTO Fedora * Please follow Category:Distributions and Category:Fedora. = Other Links = * If you're interested in installing a distribution inside coLinux, Nir Perry has posted Installing a "normal" distribution on coLinux - "The Slackware on coLinux HOWTO" on the developer's mailing list. * An additional script for dual-boot systems * IO Errors With Raw Partition ---- MassTranslated on 25 Dec 2004. ---- MassTranslated on Sun Apr 23 17:35:55 UTC 2006 Category:Distributions Category:HOWTO